package com.prawn.ift.datasearch.dao;

import com.prawn.ift.datasearch.pojo.DataRecordWithCheckItem;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface DataRecordRelaDao extends JpaRepository<DataRecordWithCheckItem,String>, JpaSpecificationExecutor<DataRecordWithCheckItem> {
    @Query(value = "SELECT ift_data_record.id,equipmentId,channelNO,checkItemId,processedData,acquisitionTime,reportingTime,isWarning,isRead,isTreatment,warningReason,ift_check_item.`name` AS checkItemName,unit" +
            "    FROM ift_data_record,ift_check_item" +
            "    WHERE ift_data_record.`checkItemId` = ift_check_item.`id` ",nativeQuery = true)
    List<DataRecordWithCheckItem> findDataRecordWithRelation(Pageable pageable);

    /*@Query(value = "SELECT ift_data_record.id,equipmentId,channelNO,checkItemId,processedData,acquisitionTime,reportingTime,isWarning,isRead,isTreatment,warningReason,ift_check_item.`name` AS checkItemName,unit" +
            "    FROM ift_data_record,ift_check_item" +
            "    WHERE ift_data_record.`checkItemId` = ift_check_item.`id` ",nativeQuery = true)
    Page<DataRecordWithCheckItem> findAll(Specification<DataRecordWithCheckItem> dataRecordServiceSpecification,Pageable pageable);*/


}
